<?php 
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

final class Options {
	public $apiNames;
	public $fields;
	public $options;
	public $validation;
	public $optionalFields;
	
	function __construct() {
                //api names
		$this->apiNames = array('twitter'=>'Twitter', 'youtube'=>'Youtube Vedio', 'flickr'=>'Flicker Photos', /*'articlebase'=>'Article Base Articles'*/);
		
                
                //twitter
		$this->options['twitter']=array('lang'=>array('type'=>'form_input', 'label'=>'Language', 'attribute'=>array('name'=>'lang','style'=>'width:65%')),
										'geocode'=>array('type'=>'form_checkbox', 'label'=>'Enable Search By Geocode',
													'attribute'=>array('name'=>'geocode', 'checked'=>FALSE,'value'=>'1')),
										'latituted'=>array('type'=>'form_input','label'=>'Latituted', 'attribute'=>array('name'=>'latituted','disabled'=>'disabled', 'class'=>'geocode', 'style'=>'width:65%')),
										'logituted'=>array('type'=>'form_input','label'=>'Logituted', 'attribute'=>array('name'=>'logituted','disabled'=>'disabled', 'class'=>'geocode', 'style'=>'width:65%')),
										'radius'=>array('type'=>'form_input','label'=>'Radius', 'attribute'=>array('name'=>'radius', 'disabled'=>'disabled', 'class'=>'geocode', 'style'=>'width:65%')),
										'unit'=>array('type'=>'form_dropdown','label'=>'Unit of radius(mile/km)', 'attribute'=>array('mi'=>'Mile', 'km'=>'Kilometer'), 'name'=>'unit','other'=>'class="geocode" disabled="disabled" style=>width:65%')
								);
		$this->validation['twitter']=array(array('field'=>'latituted','label'=>'Latituted','rules'=>'trim|numeric'),
											array('field'=>'logituted','label'=>'Logituted','rules'=>'trim|numeric'),
											array('field'=>'radius','label'=>'Radius','rules'=>'trim|numeric'),
								);
		$this->fields['twitter']=array('common'=>array('from_user_id_str'=>array('label'=> 'User Id','attribute'=>array('checked'=>FALSE)),
														'profile_image_url'=>array('label'=> 'Profile Image Url','attribute'=>array('checked'=>FALSE)),
														'created_at'=>array('label'=>'Time created','attribute'=>array('checked'=>FALSE)),
														'from_user'=>array('label'=>'User Name','attribute'=>array('checked'=>FALSE)),
														'source'=>array('label'=> 'Source','attribute'=>array('checked'=>FALSE)),
														'id_str'=>array('label'=> 'ID','attribute'=>array('checked'=>FALSE)),
														'text'=>array('label'=>'Text','attribute'=>array('checked'=>FALSE))
														)
								);
                
                //youtube
		$this->options['youtube']=array('embedcode'=>array('type'=>'form_checkbox', 'label'=>'Embed Vedio', 'attribute'=>array('name'=>'embedcode', 'checked'=>FALSE, 'value'=>'1')),
										'width'=>array('type'=>'form_input', 'label'=>'Width','attribute'=>array('name'=>'width', 'disabled'=>'disabled', 'class'=>'embedcode', 'style'=>'width:65%')),
										'height'=>array('type'=>'form_input', 'label'=>'Height','attribute'=>array('name'=>'height', 'disabled'=>'disabled', 'class'=>'embedcode', 'style'=>'width:65%')),
										'lang'=>array('type'=>'form_input', 'label'=>'Language','attribute'=>array('name'=>'lang', 'style'=>'width:65%'))
								);
		$this->fields['youtube']=array('common'=>array(
                                                                'title'=>array('label'=>'Vedio Title', 'attribute'=>array('checked'=>FALSE)),
                                                                'content'=>array('label'=>'Vedio Discription', 'attribute'=>array('checked'=>FALSE))
                    
                                                            ),
										/*'extra'=>array('width'=>array('label'=> 'Width','attribute'=>array('checked'=>FALSE)),
														'height'=>array('label'=> 'Height','attribute'=>array('checked'=>FALSE))
													)
                                                                                 * 
                                                                                 */
                                                 'extra'=>array(
                                                                'embedcode'=>array('label'=> 'Embedcode','attribute'=>array('checked'=>FALSE))
                                                            )   
                                            );
								
		$this->validation['youtube']=array(array('field'=>'width','label'=>'Width','rules'=>'trim|numeric'),
											array('field'=>'height','label'=>'Height','rules'=>'trim|numeric')
										);
                
                
                //flickr
                $this->options['flickr']=array('user_id'=>array('type'=>'form_input', 'label'=>'The NSID of the user who\'s photo to search', 'attribute'=>array('name'=>'user_id','style'=>'width:65%')),
										'tags'=>array('type'=>'form_input', 'label'=>'Photo tags(sepated by comma)',
													'attribute'=>array('name'=>'tags', 'style'=>'width:65%')),
										'image_size'=>array('type'=>'form_dropdown','label'=>'Image Size', 'attribute'=>array('s'=>'Small(75x75)', 't'=>'Thumbnail, 100 on longest side', 'm'=>'Medium, 240 on longest side', 'z'=>'Medium 640, 640 on longest side', 'b'=>'Large, 1024 on longest side'), 'name'=>'image_size','other'=>'style=>width:65%'),
                                                                                'title'=>array('type'=>'form_checkbox', 'label'=>'Ttile of the Image',
													'attribute'=>array('name'=>'title', 'checked'=>FALSE,'value'=>'1')),
								);
                
                $this->validation['flickr']=array(array('field'=>'user_id','label'=>'User id','rules'=>'trim'), 
                                                    array('field'=>'tags','label'=>'Tag','rules'=>'trim')
                                                );
                        
                $this->fields['flickr']=array('common'=>array(
                                                                'image_url'=>array('label'=>'Image Url', 'attribute'=>array('checked'=>FALSE))
                                                            ),
                                                 'extra'=>array(
                                                                'title'=>array('label'=> 'Title of the Image','attribute'=>array('checked'=>FALSE))
                                                            )   
                                            );
                
		$this->optionalFields=array('twitter'=>array('geocode'=>array()),
                                            'youtube'=>array('embedcode'=>array('embedcode')),
                                            'flickr'=>array('title'=>array('title'))
										
										);
	}
        
	public function getOptions($index){
		return $this->options[$index];
	}
	
	public function getApinames(){
		return $this->apiNames;
	}
}